package jm.mq.boot_mq.consumer;

import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @Description 延迟队列消费者——基于插件
 * @date 2022/3/10 19:34
 */
@Slf4j
//@Component
public class DelayQueueConsumer {


    // 声明队列监听器，监听死信队列QD
    @RabbitListener(queues = "delayed.queue")
    public void receiveD(Message message){
        String msg = new String(message.getBody());
        log.info("当前时间：{},收到来自死信队列消息：{}",new Date().toString(),msg);
    }

}
